/*
 *    This program is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation; either version 2 of the License, or
 *    (at your option) any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with this program; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 *    2010 year
 *    Author: Michael Khromov aka MikeDM (Mike D'Morto)
 *    E-Mail: mikedmorto@gmail.com
 */


#ifndef Mutester_HEADER
#define Mutester_HEADER

#include <QPainter>
#include <Plasma/Applet>
#include <Plasma/Svg>
#include <QRectF>
#include <QTimer>


#include "mutester_plugin_interface.h"
#include "mconfig.h"
#include "mrunner.h"
#include "mris.h"
#include "def.h"

class Mutester : public Plasma::Applet
{
    Q_OBJECT
public:
    Mutester(QObject *parent, const QVariantList &args);
    ~Mutester();
    void paintInterface(QPainter *p,
                    const QStyleOptionGraphicsItem *option,
                    const QRect& contentsRect);
    void init();
private slots:
    void slotConfigAccepted();
    //void slotConfigCancel();
    void slotTik();
    void slotRunnerErrorGet();
    void slotRunnerErrorPut();
    void slotRunnerSuccessGet();
    void slotRunnerSuccessPut();
    void slotPostPaint();

private:
    Mconfig * diacfg;
    Muconfig * cfg;
    Mrunner runner;
    Mris ris;
    void preparePaint(bool err);
    void saveConfig();
    //KConfigDialog *ps;
    void createConfigurationInterface(KConfigDialog* parent);
    KConfigGroup conf;
    QTimer timer;
    //-bool teste;
    void loadPlugins();
    QList<MutesterPluginInterface*> pluglist;

    //QPluginLoader ldr;


};

K_EXPORT_PLASMA_APPLET(mutester, Mutester)
#endif
